References

Maintenance Commands

Maintenance commands perform administrative operations on the database and application. They run with full privileges and are available only to admin users. You can execute maintenance commands through the Admin UI (Schema → Admin menu), the REST API (POST /structr/rest/maintenance/<command>), or programmatically using the maintenance() function. For details on execution methods, see the Maintenance chapter.

changeNodePropertyKey

Migrates property values from one property key to another.

Parameters

Name Description Optional
oldKey Source property key no
newKey Target property key no

Use this command when you rename a property in your schema and need to move existing data to the new key.

clearDatabase

Removes all nodes and relationships from the database.

Notes

  • Warning: This action cannot be reversed. It deletes your entire application and all data, including non-Structr nodes and relationships.

copyRelationshipProperties

Copies property values from one key to another on all relationships.

Parameters

Name Description Optional
sourceKey Source property key no
destKey Destination property key no

createLabels

Updates Neo4j type labels on nodes to match their Structr type hierarchy.

Parameters

Name Description Optional
type Limit to nodes of this type yes
removeUnused Remove labels without corresponding types (default: true) yes

Use this command after changing type inheritance or when labels are out of sync.

The command reads each node’s type property, resolves the inheritance hierarchy, and creates a label for each type in the chain.

Notes

  • Only works for nodes that have a value in their type property.

deleteSpatialIndex

Removes legacy spatial index nodes from the database.

Deletes all nodes with bbox and gtype properties.

Notes

  • This is a legacy command for cleaning up old spatial indexes. You will probably never need it.

deployData

Exports or imports application data.

Parameters

Name Description Optional
mode import or export no
source Source folder path (required for import) yes
target Target folder path (required for export) yes
types Comma-separated list of types to export yes

Exports or imports data only, not the schema or application structure. Use this for backing up or migrating data between environments.

deploy

Exports or imports a Structr application without data.

Parameters

Name Description Optional
mode import or export no
source Source folder path (required for import) yes
target Target folder path (required for export) yes
extendExistingApp If true, import merges with existing application instead of replacing it yes

Exports or imports the schema, pages, files, and security configuration. The export creates a text-based format suitable for version control.

This is the same mechanism used by the Dashboard deployment feature.

directFileImport

Imports files from a server filesystem directory into Structr’s virtual filesystem.

Parameters

Name Description Optional
source Source directory path on the server no
mode copy (keep originals) or move (delete after import) no
existing Handle duplicates: skip, overwrite, or rename (default: skip) yes
index Enable fulltext indexing for imported files (default: true) yes

Notes

  • When using Docker, copy files into the container first or use a mounted volume.

fixNodeProperties

Converts property values that were stored with an incorrect type.

Parameters

Name Description Optional
type Node type to fix no
name Specific property to fix (default: all properties) yes

Use this command after changing a property’s type in the schema, for example from String to Integer.

flushCaches

Clears all internal caches.

Use this command to reduce memory consumption or resolve cache invalidation issues.

letsencrypt

Creates or renews an SSL certificate using Let’s Encrypt.

Parameters

Name Description Optional
server staging (test certificates) or production (valid certificates) no
challenge Override the challenge method from structr.conf yes
wait Seconds to wait for DNS or HTTP challenge preparation yes
reload Reload HTTPS certificate without restart (default: false) yes

Notes

  • The letsencrypt.domains setting must contain the full domain name for the certificate.

maintenanceMode

Enables or disables the maintenance mode.

Parameters

Name Description Optional
action enable or disable no

When the maintenance mode is started, the following services are shut down:

  • FtpService
  • HttpService
  • SSHService
  • AgentService
  • CronService
  • DirectoryWatchService
  • LDAPService
  • MailService

After a short delay, the following services are restarted on different ports:

  • FtpService
  • HttpService
  • SSHService

Notes

  • Active processes will keep running until they are finished. If for example a cron job is running, it will not be halted. Only the services are stopped so no new processes are started.

rebuildIndex

Rebuilds database indexes by removing and re-adding all indexed properties.

Parameters

Name Description Optional
type Limit to this node type yes
relType Limit to this relationship type yes
mode nodesOnly or relsOnly yes

Use this command after bulk imports or when search results are inconsistent.

setNodeProperties

Sets property values on all nodes of a given type.

Parameters

Name Description Optional
type Node type to modify no
newType New value for the type property yes

All parameters except type and newType are treated as property key-value pairs to set on matching nodes.

Notes

  • Warning: After changing the type property, run createLabels to update node labels. Otherwise, nodes may not be accessible through their new type.

setRelationshipProperties

Sets property values on all relationships of a given type.

Parameters

Name Description Optional
type Relationship type to modify no

All parameters except type are treated as property key-value pairs to set on matching relationships.

Notes

  • You cannot change a relationship’s type with this command. To change the type, delete and recreate the relationship.

setUuid

Generates UUIDs for nodes and relationships that lack an id property.

Parameters

Name Description Optional
type Limit to this node type yes
relType Limit to this relationship type yes
allNodes Apply to all nodes yes
allRels Apply to all relationships yes